/*
 * Copyright 2010 - 2011, The PLDesktop Development Team
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */

#ifndef _SYS_CDEFS_H
#define _SYS_CDEFS_H

#undef	__P
#undef	__PMT

#define __inline
#define __THROW
#define __NTH(fct)	fct
#define __const		const
#define __signed		signed
#define __volatile	volatile

#define __P(args)	args
#define __PMT(args)	args

#define __CONCAT(x,y)	x ## y
#define __STRING(x)		#x

#define __ptr_t void *
#define __long_double_t  long double

#ifdef	__cplusplus
#	define __BEGIN_DECLS	extern "C" {
#	define __END_DECLS	}
#else
#	define __BEGIN_DECLS
#	define __END_DECLS
#endif

#if defined __cplusplus
#	define __BEGIN_NAMESPACE_STD	namespace std {
#	define __END_NAMESPACE_STD	}
#	define __USING_NAMESPACE_STD(name) using std::name;
#	define __BEGIN_NAMESPACE_C99	namespace __c99 {
#	define __END_NAMESPACE_C99	}
#	define __USING_NAMESPACE_C99(name) using __c99::name;
#else
#	define __BEGIN_NAMESPACE_STD
#	define __END_NAMESPACE_STD
#	define __USING_NAMESPACE_STD(name)
#	define __BEGIN_NAMESPACE_C99
#	define __END_NAMESPACE_C99
#	define __USING_NAMESPACE_C99(name)
#endif

#ifndef __BOUNDED_POINTERS__
#	define __bounded
#	define __unbounded
#	define __ptrvalue
#endif

#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
#define __bos0(ptr) __builtin_object_size (ptr, 0)

#define __warndecl(name, msg) extern void name (void)
#define __warnattr(msg)
#define __errordecl(name, msg) extern void name (void)

#define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))

#ifdef __cplusplus
#  define __REDIRECT_NTH(name, proto, alias) \
		name proto __THROW __asm__ (__ASMNAME (#alias))
#else
#  define __REDIRECT_NTH(name, proto, alias) \
		name proto __asm__ (__ASMNAME (#alias)) __THROW
#endif

#define __ASMNAME(cname)  __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
#define __ASMNAME2(prefix, cname) __STRING (prefix) cname

#define __attribute_malloc__ __attribute__ ((__malloc__))
#define __attribute_pure__ __attribute__ ((__pure__))
#define __attribute_used__ __attribute__ ((__used__))
#define __attribute_noinline__ __attribute__ ((__noinline__))
#define __attribute_deprecated__ __attribute__ ((__deprecated__))
#define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
#define __attribute_format_strfmon__(a,b) __attribute__ ((__format__ (__strfmon__, a, b)))
#define __nonnull(params) __attribute__ ((__nonnull__ params))
#define __always_inline __inline __attribute__ ((__always_inline__))
#define __va_arg_pack() __builtin_va_arg_pack ()
#define __va_arg_pack_len() __builtin_va_arg_pack_len ()

#endif
